package Java多线程技术.第2章;

public class PrintString implements Runnable {
    private boolean isContinuePrint = true;

    public boolean isContinuePrint() {
        return isContinuePrint;
    }

    public void setContinuePrint(boolean continuePrint) {
        isContinuePrint = continuePrint;
    }

    public void print() {
        try {
            while (isContinuePrint) {
                System.out.println("threadName " + Thread.currentThread().getName());
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {
//        print();

        System.out.println("jin ru run");
        while (isContinuePrint){

        }
        System.out.println("线程终止了");

    }
}
